#include "outputtestitem.h"
#include "ui_outputtestitem.h"

OutputTestItem::OutputTestItem(Output* output,QWidget *parent) :
    QWidget(parent),mOutput(output),
    ui(new Ui::OutputTestItem)
{
    ui->setupUi(this);
    initOutputInfo();
}

OutputTestItem::~OutputTestItem()
{
    delete ui;
}

void OutputTestItem::initOutputInfo()
{
    if(mOutput->getStatus()==Output::RESET)
    {
        ui->btn_set->setText("设置");
    }
    else
    {
        ui->btn_set->setText("重设");
    }
    ui->labName->setText(QString::number(mOutput->getNo()).prepend("Y").append(":"));
}

void OutputTestItem::on_btn_set_clicked()
{
    if(mOutput->getStatus()==Output::RESET)
    {
        mOutput->setStatus(Output::SET);
        ui->btn_set->setText("重设");
    }
    else
    {
        mOutput->setStatus(Output::RESET);
        ui->btn_set->setText("设置");
    }
}

//void OutputTestItem::on_btn_reset_clicked()
//{
//    mOutput->setStatus(Output::RESET);
//}
